class Solution {
public:
    int maxArea(vector<int>& height) {
        int i = 0, j = height.size() - 1;
        int ret = INT_MIN;
        while(i < j)
        {
            if(height[i] < height[j])
            {
                ret = max(ret, (j - i) * height[i++]);
            }
            else
            {
                ret = max(ret, (j - i) * height[j--]);
            }
        }
        return ret;
    }
};
